package com.sun.jdk.stream;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * Stream接口的常用方法
 * 如果我们需要找到某些数据，可以使用find方法来实现
 */
public class StreamTest14Find {
    public static void main(String[] args) {

        // 10. find
        Optional<String> first = Stream.of("10", "2", "3", "1", "5", "1", "3").findFirst();
        System.out.println(first.get());

        Optional<String> any = Stream.of("10", "2", "3", "1", "5", "1", "3").findAny();
        System.out.println(any.get());

    }
}
